
<template>

  <div>
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="文章名称">
        <el-input v-model="form.title"></el-input>
      </el-form-item>
      <el-form-item label="文章内容">
        <el-input type="textarea" v-model="form.body" show-word-limit rows="5"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">立即创建</el-button>
        <el-button>取消</el-button>
      </el-form-item>
    </el-form>
  </div>

</template>

<script>
export default {
  data() {
    return {
      form: {},
    };
  },
  methods: {
    onSubmit() {
      this.$http.post("articles", this.form).then((res) => {
        this.$message({
          message: "文章创建成功",
          type: "success",
        });
      });
      this.$emit("routerTo", "List");
    },
  },
};
</script>
  
<style>
</style>

